package soft863.com.demo1007;

import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class fMap extends Mapper<LongWritable, Text, Text, Flow> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();

        String[] s = line.split("\t");
        String phone = s[1];
        long upflow = Long.parseLong(s[8]);
        long downflow = Long.parseLong(s[9]);

        context.write(new Text(phone), new Flow(upflow, downflow, upflow + downflow));


    }
}
